<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var findValueOfPartition = function (nums) {
      let minDiff = 0x3f3f3f3f
      nums.sort((a, b) => a - b)
      for (let i = 1; i < nums.length; i++) {
        minDiff = Math.min(minDiff, nums[i] - nums[i - 1])
      }
      return minDiff
    }
    console.log(findValueOfPartition([1, 3, 2, 4]))
  </script>
</body>

</html>